package work.ib.apt.perf.common;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

import work.ib.apt.perf.TestMain;

public class GetCSRFToken extends TestMain {

	//	private static final String url = "http://localhost:8000/services/managercenter/v1/getComplexPhoneNumber";
	private static final String url = "http://dev-aptratings-services1.internetbrands.com:8080/services/managercenter/v1/getComplexPhoneNumber";

	private static final Integer parallelThreads = 30;

	private static int[] tokenTypeIds = new int[] {
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
       10,
       11,
       13,
       14,
       15,
       16,
       17,
       19,
       20,
       24,
       25,
       26,
       27,
       28,
       30,
       31,
       34,
       35,
       36,
	};

	@Override
	public int getThreadCount() {
		return 10000;
	}


	public static void main(String[] args) {
		try {
			new GetCSRFToken().runTest();
		} catch (Exception e) {
			e.printStackTrace(System.out);
		}
	}

	@Override
	public Map<String, Object> getParameters() {
		int[] dataArray = tokenTypeIds;
		long tokenTypeId = dataArray[new Random().nextInt(dataArray.length)];
		Map<String,Object> params = new HashMap<String,Object>();

		params.put("tokenTypeId", tokenTypeId);
		params.put("format", "json");

		return params;
	}

	@Override
	public int getParallelThreads() {
		return parallelThreads;
	}

	@Override
	public String getURL() {
		return url;
	}
}
